import { createApp, type VNode } from 'vue'
export const useMountComponent = function (rootComponent: VNode) {
  const app = createApp(rootComponent)
  const root = document.createElement('div')
  document.body.appendChild(root)
  return {
    instance: app.mount(root),
    unmount() {
      app.unmount()
      document.body.removeChild(root)
    },
  }
}
